<template>
  <view class="tabbar">
    <u-tabbar activeColor='#c00000' :value="cshowindex" @change="change5" :placeholder="true"
      :safeAreaInsetBottom="true">
      <u-tabbar-item text="首页" icon="home"></u-tabbar-item>
      <u-tabbar-item text="朋友圈" icon="photo"></u-tabbar-item>
      <u-tabbar-item text="影视资源" icon="play-right"></u-tabbar-item>
      <u-tabbar-item text="我的" icon="account"></u-tabbar-item>
    </u-tabbar>
  </view>
</template>

<script>
  import {
    mapState,
    mapMutations
  } from "vuex"
  import {
    fabudailyrecord,
    getfabudailyrecord
  } from "@/api/user.js"
  export default {
    props: ['cshowindex'],
    data() {
      return {
        value6: this.cshowindex || 0,
      };
    },

    methods: {
      ...mapMutations("m_login", ["setFabuinfo"]),
      change5(name) {
        this.$emit('getcindex', name)
        if (name === 1) {
          if (!uni.getStorageSync('token')) return uni.$u.toast('请您先登录')
          getfabudailyrecord().then(res => {
            this.setFabuinfo(res.data)
          })
        } else this.value6 = name
      },
    }
  }
</script>

<style lang="scss" scoped>
  ::-webkit-scrollbar {
    display: none;
    width: 0 !important;
    height: 0 !important;
    -webkit-appearance: none;
    background: transparent;
  }

  /deep/ .u-tabbar-item {
    background-color: black;
  }

  .tabbar {
    width: 100vw;
    position: absolute;
    bottom: 0;
  }
</style>
